#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: title05_2非严格递增连续数字序列.py 
@version:
@time: 2023/05/26 
"""


def solve(line):
    cur_len, max_len = 0, 0
    last = 'a'
    for cur in line:
        if cur.isdigit():
            if cur_len == 0 or cur >= last:
                cur_len += 1
            else:
                max_len = max(cur_len, max_len)
                cur_len = 1
            last = cur
        else:
            max_len = max(cur_len, max_len)
            cur_len = 0
            last = 'a'
    print(max_len)


solve(input())
